<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <style type="text/css" media="screen">
        @import url("<c:url value="/resources/dojo/resources/dojo.css"/>");
        @import url("<c:url value="/resources/dijit/themes/tundra/tundra.css"/>");
        @import url("<c:url value="/static/styles/finance.css"/>");
    </style>

    <script djconfig="parseOnLoad: true" src="<c:url value="/resources/dojo/dojo.js"/>" type="text/javascript"></script>
    <script type="text/javascript" src="<c:url value="/resources/spring/Spring.js" />"></script>
    <script type="text/javascript" src="<c:url value="/resources/spring/Spring-Dojo.js" />"></script>
    <script type="text/javascript">dojo.require("dojo.parser");</script>
    <title>Spring Finance</title>

</head>

<body class="tundra spring">

<div id="wrap">

    <div id="menu">
        <%@ include file="/WEB-INF/jsp/menu.jsp" %>
    </div>
    <div id="main">
        <div id="body">


            <script type="text/javascript">dojo.require("dijit.TitlePane");
            dojo.require("dijit.MultiSelect");</script>
            <div dojoType="dijit.TitlePane" style="width: 100%" title="Create New Person">
                <form:form action="/person" method="POST" modelAttribute="person">
                    <form:errors path="*" cssClass="errors"/><br/>

                    <div>
                        <label for="firstName">First Name:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="firstName" size="30"/>
                        <form:errors path="firstName" cssClass="errors"/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "firstName", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter First Name", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="lastName">Last Name:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="lastName" size="30"/>
                        <form:errors path="lastName" cssClass="errors"/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "lastName", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter Last Name", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="email">Email:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="email" size="30"/>
                        <form:errors path="email" cssClass="errors"/><br/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "email", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {invalidMessage: "Enter Email (numbers only)", regExp: "[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="password">Password:</label>
                        <form:password cssStyle="width:250px" maxlength="30" path="password" size="30"/>
                        <form:errors path="password" cssClass="errors"/><br/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "password", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {invalidMessage: "Enter Account Password", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <c:if test="${not empty authorities}">
                            <label for="authorities">Authorities:</label>
                            <form:select cssStyle="width:250px" path="authorities">
                                <form:options itemValue="id" items="${authorities}"/>
                            </form:select>
                            <form:errors path="authorities" cssClass="errors"/>
                            <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "manager", widgetType: "dijit.form.MultiSelect", widgetAttrs : {hasDownArrow : true}})); </script>
                        </c:if>
                    </div>
                    <br/>

                    <div>
                        <label for="streetName">Street Name:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="address.streetName" id="streetName"
                                    size="30"/>
                        <form:errors path="address.streetName" cssClass="errors"/><br/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "streetName", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter Street Name", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="streetNumber">Street Number:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="address.streetNumber" id="streetNumber"
                                    size="30"/>
                        <form:errors path="address.streetNumber" cssClass="errors"/><br/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "streetNumber", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter Street Number", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="city">City:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="address.city" id="city" size="30"/>
                        <form:errors path="address.city" cssClass="errors"/><br/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "city", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter City", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="zipCode">Zip Code:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="address.zipCode" id="zipCode"
                                    size="30"/>
                        <form:errors path="address.zipCode" cssClass="errors"/><br/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "zipCode", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter Zip Code", required : true}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="state">State:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="address.state" id="state" size="30"/>
                        <form:errors path="address.state" cssClass="errors"/><br/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "state", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter State", required : false}})); </script>
                    </div>
                    <br/>

                    <div>
                        <label for="country">Country:</label>
                        <form:input cssStyle="width:250px" maxlength="30" path="address.country" id="country"
                                    size="30"/>
                        <form:errors path="address.country" cssClass="errors"/>
                        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : "country", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "Enter Country", required : false}})); </script>
                    </div>
                    <br/>

                    <div class="submit">
                        <script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));</script>
                        <input id="proceed" type="submit" value="Save"/>
                    </div>
                </form:form>
            </div>
        </div>
        <table class="footer">
            <tr>
                <td><a href="<c:url value="/" />">Home</a></td>
                <td align="right"><a href="http://stsmedia.net" alt="StSMedia.net">StSMedia.net</a></td>
            </tr>
        </table>

    </div>
</div>
</body>

</html>